<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
		xmlns:h="http://www.w3.org/1999/xhtml"
		xmlns="http://www.w3.org/1999/xhtml"
		exclude-result-prefixes="h l">

  <!-- Stylesheet containing all htmlbook-xsl params, and their default values -->

  <xsl:output method="xml"
              encoding="UTF-8"/>
  <xsl:preserve-space elements="*"/>

  <!-- Verbose log output; off by default -->
  <xsl:param name="verbose" select="0"/>

  <xsl:param name="book-language">
    <xsl:choose>
      <xsl:when test="//h:html[@lang != '']|//h:body[@lang != '']">
	<xsl:value-of select="(//h:html[@lang != '']|//h:body[@lang != ''])[1]/@lang"/>
      </xsl:when>
      <xsl:otherwise>
	<xsl:text>en</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:param>

  <xsl:param name="localizations-dir" select="'localizations/'"/>

  <xsl:param name="localizations">
    <xsl:variable name="localizations-file">
      <xsl:value-of select="concat($localizations-dir, $book-language, '.xml')"/>
    </xsl:variable>
    <xsl:choose>
      <!-- If $localizations-file is valid, use it... -->
      <xsl:when test="document($localizations-file)//l:l10n">
	<xsl:copy-of select="document($localizations-file)"/>
      </xsl:when>
      <!-- Otherwise default to "en" (English) -->
      <xsl:otherwise>
	<xsl:copy-of select="document(concat($localizations-dir, 'en', '.xml'))"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:param>

  <!-- For chunking templates: specify a number from 0 to 5, where 0 means chunk at top-level sections (part, chapter, appendix), and 1-5 means chunk at the corresponding sect level (sect1 - sect5) -->
  <xsl:param name="chunk.level" select="0"/>

  <!-- Titling and labeling params -->

  <!-- Specify whether to autogenerate labels on sectioning and formal elements in HTML output (as opposed to labeling with CSS); default is to not include labels (0) -->
  <xsl:param name="autogenerate.labels" select="0"/>
  
  <!-- Specify whether to autogenerate labels in bookmark attributes for PDF output (@data-pdf-bookmark)-->
  <xsl:param name="autogenerate.pdf.bookmark.labels" select="1"/>

  <!-- Separator to be used between label and title -->
  <xsl:param name="label.and.title.separator" select="'. '"/>

  <!-- Separator to be used between parts of a label -->
  <xsl:param name="intralabel.separator" select="'.'"/>

<!-- For any book division that you want to have numeration, specify the @data-type, followed by colon, 
     and then a valid @format value for <xsl:number/>. If there is no entry in this list, or "none" is specified, corresponding division
     will not get labeled -->
  <xsl:param name="label.numeration.by.data-type">
appendix:A
chapter:1
part:I
sect1:none
sect2:none
sect3:none
sect4:none
sect5:none
  </xsl:param>

  <!-- When labeling sections, also label their ancestors, e.g., 3.1, 3.2.1 -->
  <xsl:param name="label.section.with.ancestors" select="0"/>

  <!-- When labeling formal objects (figures, tables, examples), also label the chapter-level ancestor, e.g., 3-1 -->
  <xsl:param name="label.formal.with.ancestor" select="1"/>

  <!-- Index-specific params -->
  <xsl:param name="autogenerate-index" select="1"/>

  <xsl:param name="index.on.role" select="0"/>

  <xsl:param name="index.on.type" select="0"/>

  <xsl:param name="index.links.to.section" select="0"/>

  <xsl:param name="index.term.separator"/>

  <xsl:param name="index.number.separator"/>

  <xsl:param name="index.range.separator"/>

  <!-- Specify whether or not to overwrite any content in the index placeholder element -->
  <xsl:param name="index-placeholder-overwrite-contents" select="0"/>

  <!-- TOC-specific params -->
  <xsl:param name="autogenerate-toc" select="1"/>

  <!-- Specify whether or not to overwrite any content in the TOC placeholder element -->
  <xsl:param name="toc-placeholder-overwrite-contents" select="0"/>

  <!-- Specify whether or not to include a title in autogenerated TOC -->
  <xsl:param name="toc-include-title" select="0"/>

  <!-- Specify whether to include number labels in TOC entries -->
  <xsl:param name="toc-include-labels" select="0"/>

  <!-- Specify how many levels of sections to include in TOC. 
       A $toc.section.depth of 0 indicates only chapter-level headings and above to be included in TOC
       A $toc.section depth of 1 indicates only sect1-level headings and above to be included in TOC
       And so on...
    -->
  <xsl:param name="toc.section.depth" select="2"/>

  <!-- Param to specify whether or not to include inline markup tagging (e.g., "em", "code") in generated XHTML TOC -->
  <xsl:param name="inline.markup.in.toc" select="1"/>

  <!-- XREF-specific params -->
  <xsl:param name="autogenerate-xrefs" select="1"/>

  <!-- Specifies type of XREF to use for different kinds of sections -->
  <!-- Choices are:
       * xref-number-and-title
       * xref-number
       * xref
    -->
  <xsl:param name="xref.type.for.section.by.data-type">
appendix:xref-number
chapter:xref-number
part:xref-number
sect1:xref
sect2:xref
sect3:xref
sect4:xref
sect5:xref
  </xsl:param>

<!-- Autogenerate data-xref-pagenum-style attributes; useful for paged output (e.g., PDF) -->
<xsl:param name="autogenerate.xref.pagenum.style" select="1"/>

<!-- Valid pagenum styles correspond to valid counter/list-style-type styles (http://www.w3.org/TR/2011/REC-CSS2-20110607/generate.html#propdef-list-style-type)
     decimal, decimal-leading-zero, lower-roman, upper-roman, georgian, armenian 
-->
<!-- Top-level sections listed here only; presumption is that pagenum type is set on top-level sections only,
     and is inherited by lower-level sections -->
<xsl:param name="xref.pagenum.style.for.section.by.data-type">
acknowledgments:decimal
afterword:decimal
appendix:decimal
bibliography:decimal
chapter:decimal
colophon:decimal
conclusion:decimal
copyright-page:decimal
dedication:lower-roman
foreword:lower-roman
glossary:decimal
halftitlepage:lower-roman
index:decimal
introduction:decimal
part:decimal
preface:lower-roman
titlepage:lower-roman
toc:lower-roman
</xsl:param>

  <!-- Render @href text in parens following <a> element for external hyperlinks; useful for print outputs -->
  <xsl:param name="url.in.parens" select="1"/>

  <!-- Code-specific params -->

  <!-- Add line numbers to code listings globally -->
  <xsl:param name="number.code.lines" select="0"/>

  <!-- Footnote-specific params -->

  <!-- Process footnotes into separate marker/hyperlink and footnote content, and move to end of sections -->
  <xsl:param name="process.footnotes" select="0"/>

  <!-- Generate hardcoded superscripted markers for footnotes, but don't move footnote contente to end of sections -->
  <xsl:param name="process.footnote.callouts.only" select="0"/>

  <!-- Reset footnote numbering at chapter level elements (children of part or body) -->
  <xsl:param name="footnote.reset.numbering.at.chapter.level" select="1"/>

  <!-- Numeration format for table footnotes -->
  <xsl:param name="table.footnote.numeration.format" select="'a'"/>

  <!-- Numeration format for non-table footnotes -->
  <xsl:param name="footnote.numeration.format" select="'1'"/>

  <!-- Admonition-specific params -->
  <!-- Add title heading elements for different admonition types that do not already have headings in markup -->
  <xsl:param name="add.title.heading.for.admonitions" select="0"/>

  <!-- Filename of CSS to be embedded in <link> in output in HTML <head> -->
  <!-- Leave blank to omit CSS -->
  <xsl:param name="css.filename"/>

  <!-- When set to 1, duplicate HTML5 structural elements like <section> and <figure> as <div>,
       and convert <figcaption> to <h6> -->
  <xsl:param name="html4.structural.elements" select="0"/>

  <!-- When set to 1, add a <div> within a <figure> to encapsulate all the non-caption <figure> content (to facilitate styling) -->
  <xsl:param name="figure.border.div" select="0"/>

  <!-- Params around page numeration -->

  <!-- Add a class of "pagenum" to XREFs pointing to element in the supplied list -->
  <!-- Element names correspond to values produced by "semantic-name" template in common.xsl -->
  <xsl:param name="xref.elements.pagenum.in.class">
sect1
sect2
sect3
sect4
sect5
sidebar
refsect1
refsect2
refentry
note
tip
warning
</xsl:param>

  <!-- Params for handling of comments in a manuscript -->

  <!-- Turn on this parameter (off by default) to toggle on display of comments in the manuscript 
       (both XML comments and elements tagged with data-type="comment")
    -->
  <xsl:param name="show-comments" select="0"/>

</xsl:stylesheet> 
